import Api from '@/api/system/users'
import i18n from "@/lang/index";
const contentConfig = {
  pageName: "sys:user",
  table: {
    border: true,
    highlightCurrentRow: false,
  },
  indexAction: (data) => {
    console.log("index", data);
    let params = {
      ...data,
      is_test:'否'
    }
    return new Promise((resolve, reject) => {
      Api.getList(params).then(s => {
        console.log(s);
        resolve(s)
      }).catch(e => {
        console.log(e);
        reject(e)
      })
    });
  },
  deleteAction: function (id) {
    console.log("delete", id);
    return new Promise((resolve, reject) => {
      Api.del({ id }).then(s => {
        resolve({
          code: "00000",
          data: null,
          msg: i18n.global.t("hint.7"),
        })
      }).catch(e => {
        reject(e)
      })
    });
  },
  exportAction: function (queryParams) {
    // 导出Excel文件
    // return exportUser(queryParams);
  },
  pk: "id",
  toolbar: [
    "refresh",
    "add",
    // "delete",
    // "export",
    // {
    //   name: "import",
    //   icon: "upload",
    //   text: "导入",
    //   auth: "import",
    // },
  ],
  cols: [
    { type: "selection", width: 50, align: "center" ,fixed: "left"},
    { label: i18n.global.t("label.15"), align: "center", prop: "id", width: 100 ,fixed: "left"},
    { label: i18n.global.t("form.1"), align: "center", prop: "username",minWidth: 150 ,fixed: "left"},
    { label: i18n.global.t("form.68"), align: "center", prop: "name",minWidth: 150, },
    { label: i18n.global.t("label.64"), align: "center",prop: "vip_level.name", minWidth: 150, },
    { label: i18n.global.t("label.1"), align: "center", prop: "phone_number", minWidth: 150, },
    { label: 'Email', align: "center", prop: "email", minWidth: 200, },
    { label: i18n.global.t("label.23"), align: "center", prop: "status", templet: 'custom', minWidth: 150, },
    { label: i18n.global.t("label.3"), align: "center", prop: "balance", sortable: true, templet: 'customStor', minWidth: 150, },
    { label: i18n.global.t("label.53"), align: "center", prop: "currency_code" },
    { label: i18n.global.t("label.106"), align: "center", prop: "is_test", templet: 'custom', minWidth: 150, },
    { label: i18n.global.t("label.117"), align: "center", prop: "parent_id",minWidth: 150, },
    { label: i18n.global.t("label.5"), align: "center", prop: "has_deposited", templet: 'custom', slotName: "has_deposited", minWidth: 150, },
    { label: i18n.global.t("label.6"), align: "center", prop: "ip_address" },
    { label: i18n.global.t("label.7"), align: "center", type: "time", prop: "created_at", width: 180 },
    {
      label: i18n.global.t("label.8"),
      fixed: "right",
      width: 220,
      align: "center",
      templet: "tool",
      operat: [
        {
          name: "view",
          text: i18n.global.t("oper.3"),
          type: "warning"
        },
        "edit",
        "delete",
        {
          name: "password",
          text: i18n.global.t("oper.13"),
          type: "primary"
        },
        {
          name: "payment_password",
          text: i18n.global.t("oper.14"),
          type: "primary"
        },
      ],
    },
  ],
};

export default contentConfig;
